import $http from './request.js';
import store from '../store/index.js';
// 获取基础数据
$http({
  url: '/public/common/basicData/selectByType',
  method: 'POST',
  data: {
    "dataType": 0,
    "pageNum": 1,
    "pageSize": 10000
  }
}).then(data => {
  console.log(666)
  // 数据类别：1：公司类型；2：驳回原因；3：所属行业；4：经营状态
  if (data.code == 0) {
    let companyType = {}
    let reasonsRejection = {}
    let industry = {}
    let managementState = {}
    let companyTypeArr = []
    let reasonsRejectionArr = []
    let industryArr = []
    let managementStateArr = []
    let d = data.result.list
    for (let i = 0; i < d.length; i++) {
      if (d[i].dataType == 1) {
        // 公司类型
        companyType[d[i].dataCode] = d[i].dataMsg
        companyTypeArr.push(d[i])
      }
      if (d[i].dataType == 2) {
        // 驳回原因
        reasonsRejection[d[i].dataCode] = d[i].dataMsg
        reasonsRejectionArr.push(d[i])
      }
      if (d[i].dataType == 3) {
        // 所属行业
        industry[d[i].dataCode] = d[i].dataMsg
        industryArr.push(d[i])
      }
      if (d[i].dataType == 4) {
        // 经营状态
        managementState[d[i].dataCode] = d[i].dataMsg
        managementStateArr.push(d[i])
      }
    }

    store.commit("updateBasicData", {
      companyType,
      companyTypeArr,
      reasonsRejection,
      reasonsRejectionArr,
      industry,
      industryArr,
      managementState,
      managementStateArr
    })
  }
})